<script setup lang="ts" name="userTopLeft">
import type { UserInfoUser } from '@/types/loginType'
import {
  User,
  Female,
  Message,
  EditPen,
  Phone,
  LocationInformation,
  Sunrise,
  MoonNight
} from '@element-plus/icons-vue'
// 获取数据

defineProps<{
  user: UserInfoUser
}>()
</script>

<template>
  <div id="userTopLeft">
    <span>
      <div><img :src="user.img" alt="" /></div>
      <p>{{ user.id }}</p>
    </span>
    <span>
      <p>
        <User class="svg" /><b>{{ user.name }}</b>
      </p>
      <p v-if="user.gender === 'male'"><Male class="svg" /><b>男</b></p>
      <p v-else><Female class="svg" /><b>女</b></p>
      <p>
        <Phone class="svg" /><b>{{ user.tel }}</b>
      </p>
      <p>
        <Message class="svg" /><b>{{ user.email }}</b>
      </p>
      <p>
        <Sunrise class="svg" /><b>{{ user.registAt }}</b>
      </p>
      <p>
        <MoonNight class="svg" /><b>{{ user.lastAt }}</b>
      </p>
      <p class="sign">
        <LocationInformation class="svg" /><b>{{ user.address }}</b>
      </p>
      <p class="sign">
        <EditPen class="svg" /><b>{{ user.bio }}</b>
      </p>
      <input type="text" v-show="false" />
    </span>
  </div>
</template>

<style scoped lang="less">
* {
  color: var(--color2);
}

.svg {
  display: inline-block;
  vertical-align: middle;
  width: 20px;
  height: 20px;
  margin: 0 4px;
  color: var(--color2);
}

#userTopLeft {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
}
span:first-of-type {
  display: inline-block;
  vertical-align: middle;
  height: 160px;
  > div {
    position: relative;
    display: inline-block;
    height: 80%;
    width: 126px;
    > img {
      border-radius: var(--radius);
      position: absolute;
      top: 50%;
      left: 50%;
      translate: -50% -50%;
      pointer-events: none;
      width: 96px;
      height: 96px;
    }
  }
  > p {
    display: block;
    width: 126px;
    text-align: center;
  }
}
span:nth-child(2) {
  display: inline-grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: center;
  vertical-align: middle;
  height: 100%;
  width: calc(100% - 126px);
  > p {
    white-space: nowrap;
    margin: 8px 10px 0;
    height: 32px;
    > b {
      vertical-align: middle;
      color: var(--color2);
    }
  }
  > .sign {
    grid-column: 1 / 4;
    > b {
      max-width: 400;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowarp;
      color: var(--color2);
    }
  }
}
</style>
